import java.util.Arrays;
import java.util.Scanner;

public class Main1161 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int m= sc.nextInt();
        int n= sc.nextInt();
        int[] arr=new int[n];
        for (int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        int[] newarr = new int[arr.length+1];
        for (int i=0;i<arr.length;i++){
            newarr[i]=arr[i];
        }
        newarr[arr.length]=m;
        arr=newarr;
        //变化区域
        Arrays.sort(arr);
        //变化区域
        for (int i :arr) {
            System.out.print(i + " ");
        }
//        //倒序输出
//        for (int i = arr.length - 1; i >= 0; i--) {
//            System.out.print(arr[i] + " ");
//        }
    }
}
